c$$$Return-Path: <@CEARN.cern.ch:HEPLIBSP@CERNVM.BITNET>
c$$$Received: from CEARN.cern.ch ([128.141.2.9]) by esm.cc.flinders.edu.au (4.1/SMI-4.0)
c$$$	id AA28651; Mon, 14 Dec 92 20:13:17 CST
c$$$Message-Id: <9212140943.AA28651@esm.cc.flinders.edu.au>
c$$$Received: from CERNVM.cern.ch by CEARN.cern.ch (IBM VM SMTP V2R2)
c$$$   with BSMTP id 9125; Mon, 14 Dec 92 10:41:48 SET
c$$$Received: from CERNVM.CERN.CH (HEPLIBSP) by CERNVM.cern.ch (Mailer R2.08) with
c$$$ BSMTP id 9204; Mon, 14 Dec 92 10:43:54 SET
c$$$Date: 14 Dec 92   10:43 SET
c$$$From: HEPLIBSP@CERNVM.CERN.CH
c$$$To: DIMA@ESM
c$$$Subject: Mail from CERNVM
c$$$Status: R
c$$$
CDECK  ID>, ASLGF.
      SUBROUTINE ASLGF(MODE,X,M,NL,P)
      DIMENSION P(0:*)
      DOUBLE PRECISION
     +     D,DP(0:100)

      SROUND(D)=D+(D-SNGL(D))
      CALL DASLGF(MODE,DBLE(X),M,NL,DP)
      DO 1 N = 0,NL
    1 P(N)=SROUND(DP(N))
      RETURN
      END
CDECK  ID>, ASLGF64.
      SUBROUTINE DASLGF(MODE,X,MS,NL,P)
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      CHARACTER NAME*(*)
      CHARACTER*80 ERRTXT
      PARAMETER (NAME = 'ASLGF/DASLGF')
      PARAMETER (ML=55)
      DIMENSION P(0:*),FCT(0:ML)

      PARAMETER (Z1 = 1, HF = Z1/2)

      DATA FCT( 0) /0.100000000000000000D+01/
      DATA FCT( 1) /0.100000000000000000D+01/
      DATA FCT( 2) /0.200000000000000000D+01/
      DATA FCT( 3) /0.600000000000000000D+01/
      DATA FCT( 4) /0.240000000000000000D+02/
      DATA FCT( 5) /0.120000000000000000D+03/
      DATA FCT( 6) /0.720000000000000000D+03/
      DATA FCT( 7) /0.504000000000000000D+04/
      DATA FCT( 8) /0.403200000000000000D+05/
      DATA FCT( 9) /0.362880000000000000D+06/
      DATA FCT(10) /0.362880000000000000D+07/
      DATA FCT(11) /0.399168000000000000D+08/
      DATA FCT(12) /0.479001600000000000D+09/
      DATA FCT(13) /0.622702080000000000D+10/
      DATA FCT(14) /0.871782912000000000D+11/
      DATA FCT(15) /0.130767436800000000D+13/
      DATA FCT(16) /0.209227898880000000D+14/
      DATA FCT(17) /0.355687428096000000D+15/
      DATA FCT(18) /0.640237370572800000D+16/
      DATA FCT(19) /0.121645100408832000D+18/
      DATA FCT(20) /0.243290200817664000D+19/
      DATA FCT(21) /0.510909421717094400D+20/
      DATA FCT(22) /0.112400072777760768D+22/
      DATA FCT(23) /0.258520167388849766D+23/
      DATA FCT(24) /0.620448401733239439D+24/
      DATA FCT(25) /0.155112100433309860D+26/
      DATA FCT(26) /0.403291461126605636D+27/
      DATA FCT(27) /0.108888694504183522D+29/
      DATA FCT(28) /0.304888344611713861D+30/
      DATA FCT(29) /0.884176199373970195D+31/
      DATA FCT(30) /0.265252859812191059D+33/
      DATA FCT(31) /0.822283865417792282D+34/
      DATA FCT(32) /0.263130836933693530D+36/
      DATA FCT(33) /0.868331761881188650D+37/
      DATA FCT(34) /0.295232799039604141D+39/
      DATA FCT(35) /0.103331479663861449D+41/
      DATA FCT(36) /0.371993326789901217D+42/
      DATA FCT(37) /0.137637530912263450D+44/
      DATA FCT(38) /0.523022617466601112D+45/
      DATA FCT(39) /0.203978820811974434D+47/
      DATA FCT(40) /0.815915283247897734D+48/
      DATA FCT(41) /0.334525266131638071D+50/
      DATA FCT(42) /0.140500611775287990D+52/
      DATA FCT(43) /0.604152630633738356D+53/
      DATA FCT(44) /0.265827157478844877D+55/
      DATA FCT(45) /0.119622220865480195D+57/
      DATA FCT(46) /0.550262215981208895D+58/
      DATA FCT(47) /0.258623241511168181D+60/
      DATA FCT(48) /0.124139155925360727D+62/
      DATA FCT(49) /0.608281864034267561D+63/
      DATA FCT(50) /0.304140932017133780D+65/
      DATA FCT(51) /0.155111875328738228D+67/
      DATA FCT(52) /0.806581751709438786D+68/
      DATA FCT(53) /0.427488328406002556D+70/
      DATA FCT(54) /0.230843697339241380D+72/
      DATA FCT(55) /0.126964033536582759D+74/
   10 IF(ABS(X) .GT. 1) THEN
       WRITE(ERRTXT,101) X
       CALL MTLPRT(NAME,'C330.1',ERRTXT)
       RETURN
      ENDIF
      IF(MODE .NE. 1 .AND. MODE .NE. 2) THEN
       WRITE(ERRTXT,102) MODE
       CALL MTLPRT(NAME,'C330.2',ERRTXT)
       RETURN
      ENDIF

      M=ABS(MS)
      IF(M .EQ. 0) THEN
       IF(NL .LT. 0 .OR. NL .GT. 100) THEN
        WRITE(ERRTXT,103) MS,NL
        CALL MTLPRT(NAME,'C330.3',ERRTXT)
        RETURN
       ENDIF
       P(0)=1
       P(1)=X
       DO 1 N = 1,NL-1
    1  P(N+1)=((2*N+1)*X*P(N)-N*P(N-1))/(N+1)
       IF(MODE .EQ. 2) THEN
        DO 2 N = 0,NL
    2   P(N)=SQRT(N+HF)*P(N)
       ENDIF
      ELSE
       IF(NL .LT. 0 .OR. M .GT. 27 .OR. NL .GT. ML-M) THEN
        WRITE(ERRTXT,103) MS,NL
        CALL MTLPRT(NAME,'C330.3',ERRTXT)
        RETURN
       ENDIF
       DO 3 N = 0,M-1
    3  P(N)=0
       P(M)=HF**M*FCT(2*M)/FCT(M)
       DO 4 N = M,NL-1
    4  P(N+1)=((2*N+1)*X*P(N)-(N+M)*P(N-1))/(N-M+1)
       R=SQRT(1-X**2)**M
       DO 5 N = M,NL
    5  P(N)=R*P(N)
       IF(MODE .EQ. 2) THEN
        DO 6 N = M,NL
    6   P(N)=SQRT((N+HF)*(FCT(N-M)/FCT(N+M)))*P(N)
       ELSEIF(MS .LT. 0) THEN
        DO 7 N = M,NL
    7   P(N)=(FCT(N-M)/FCT(N+M))*P(N)
       ENDIF
      ENDIF
      RETURN
  101 FORMAT('INCORRECT ARGUMENT X = ',1P,E15.6)
  102 FORMAT('INCORRECT MODE = ',I5)
  103 FORMAT('INDICES M = ',I5,' OR NL = ',I5,' NOT PERMITTED')
      END
